/**********************************************
*  Namespace: Phx
*  Classes:   RK4Integrator
*  Desc:      Runge Kutta 4 integration
*  Notes:     Includes code from Glenn Fiedler
*  Author:    Vaios Kalpias-Ilias (C) 2008-2009
***********************************************/

#ifndef RK4INTEGRATOR_H
#define RK4INTEGRATOR_H

#include "Vector.h"

namespace Phx
{
	class RK4Integrator
	{
	public:
		
		// Runge Kutta 4 integration
		template< typename T>
		static void Integrate(T& pos,
							  T& vel,
							  const T& acc,
							  float dt)
		{
			// calculate derivatives at the required dt's
			T newAcc = acc*dt;
			pos +=  (vel + newAcc*0.5f) * dt;
			vel +=  newAcc;
		}

	private:

		RK4Integrator();
		~RK4Integrator();

	};
} // end of namespace Phx

#endif